package com.ksu.manager.model.pages;

import com.ksu.manager.util.SysContext;

public class Pagination {

	/**
	 * 起始数量
	 */
	private int startNumber;
	
	/**
	 * 每页查询数量
	 */
	private int pageNumber;
	

	/**
	 * 总数量
	 */
	private int sum;
	
	/**
	 * 总页数
	 */
	private int totalPage;
	
	/**
	 * 当前页数
	 */
	private int currentPage;


	public int getSum() {
		return sum;
	}

	public void setSum(int sum) {
		this.sum = sum;
	}

	public int getTotalPage() {
		return totalPage;
	}

	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}

	public int getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
		this.startNumber = (currentPage-1) * getPageNumber();
	}
	public int getStartNumber() {
		return startNumber;
	}

	public void setStartNumber(int startNumber) {
		this.startNumber = startNumber - 1;
	}

	public int getPageNumber() {
		if(pageNumber > 0){
		    return pageNumber;
		}else{
			return SysContext.PAGENUM;
		}
	}

	public void setPageNumber(int pageNumber) {
		this.pageNumber = pageNumber;
	}
	
	public void init(){
		setCurrentPage(1);
		setStartNumber(0);
		setPageNumber(SysContext.PAGENUM);
	}
	
	 

	
}
